﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel;

namespace Mole
{
    public class UrlView : INotifyPropertyChanged
    {
        private String _URL; 
        private Boolean _validURI;
        private Boolean _validDNS;

        public event PropertyChangedEventHandler PropertyChanged;

        public String URL
        {
            get { return _URL; }

            set
            {
                _URL = value;
                this.NotifyPropertyChanged("URL");
            }
        }

        public Boolean ValidURI
        {
            get { return _validURI; }

            set
            {
                _validURI = value;
                this.NotifyPropertyChanged("ValidURI");
            }
        }

        public Boolean ValidDNS
        {
            get { return _validDNS; }

            set
            {
                _validDNS = value;
                this.NotifyPropertyChanged("ValidDNS");
            }
        }

        internal UrlView()
        {
        }

        public UrlView(UrlCheck url)
        {
            if (url.ValidUri)
            {
                this._URL = url.Host;
            }
            else
            {
                this._URL = url.RawUrl;
            }

            this._validURI = url.ValidUri;
            this._validDNS = url.ValidHost;
        }


        private void NotifyPropertyChanged(String name)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(name));
            }
        }

    }

    
}
